package com.ylbh.modules.userauths.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ylbh.common.pojo.userauth.UserAuthDTO;
import com.ylbh.common.pojo.userauth.vo.ShoppingUserAuthVO;
import com.ylbh.common.utils.PageUtils;
import com.ylbh.modules.userauths.mapper.ShoppingUserAuthMapper;
import com.ylbh.modules.userauths.service.ShoppingUserAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: czx
 * @date: 2019/09/06 10:41
 */
@Service
public class ShoppingUserAuthServiceImpl extends ServiceImpl<ShoppingUserAuthMapper, ShoppingUserAuthVO> implements ShoppingUserAuthService {

    @Autowired
    private ShoppingUserAuthMapper shoppingUserAuthMapper;

    /**
     * 授权列表
     * @param userAuthDTO
     * @return
     */
    @Override
    public PageUtils queryToGrantAuthorizationList(UserAuthDTO userAuthDTO) {
        Page<Integer> page = new Page<>(userAuthDTO.getPage(), userAuthDTO.getLimit());
        List<ShoppingUserAuthVO> list = shoppingUserAuthMapper.selectToGrantAuthorizationList(userAuthDTO, page);
        return new PageUtils(new Page<ShoppingUserAuthVO>().setRecords(list).setTotal(page.getTotal()));
    }
}
